// JavaScript Document
function ajax_general(){
	var xmlHttp;
    try{
		xmlHttp = new XMLHttpRequest();
		}
	catch(e){
		try{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
      		}
		catch(e){
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
          		}
			catch(e){
				return false;
				}																	
      		}																	
   		} 
	return xmlHttp;															
	}
function setHomePage(siteURL) {
    document.body.style.behavior = "url(#default#homepage)";
    document.body.setHomePage(siteURL);
	}
function ChangeLanguage(response, strurl, language){
	if(response != ""){
		window.location = response;
		}
	else{
		url = document.getElementById('urlLanguage').value+"?strurl="+strurl+'&lang='+language;
		AjaxChangeLanguage(url);
		}
	}
function AjaxChangeLanguage(url){
	var SendFriend = ajax_general();
	if(SendFriend){
		SendFriend.open("GET", url, true);
		SendFriend.onreadystatechange = function() {
			if(SendFriend.readyState == 4 && SendFriend.status == 200){
				var xmlDocumentSendFriend = SendFriend.responseXML;
				var funcSendFriend = xmlDocumentSendFriend.getElementsByTagName('method')[0].firstChild.data;
				var responseSendFriend = xmlDocumentSendFriend.getElementsByTagName('result')[0].firstChild.data;
				eval(funcSendFriend+'(responseSendFriend, \'\', \'\')')
				}
			};
		SendFriend.send(null);
		}
	else{
		alert("There was a problem retrieving the XML data:\n" + SendFriend.statusText);
		}
	}
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	}
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	}
function trim( value ) {
	return LTrim(RTrim(value));
	}
function getById(strId){
	return encodeURIComponent(document.getElementById(strId).value);
	}
function getValue(strId){
	return trim(document.getElementById(strId).value);
	}
function setFocus(strId){
	document.getElementById(strId).focus();
	}
function setValInnerHTML(strId,strVal){
	document.getElementById(strId).innerHTML = strVal;
	}
function displayElement(strId,strVal){
	document.getElementById(strId).style.display = strVal;
	}
function setValue(strId,strVal){
	document.getElementById(strId).value = strVal;
	}
function checkFrmLogin(){
	if(getValue('username')==''){
		alert(getValue('err_email_null'));
		setFocus('username');
		displayElement('mess_err','');
		setValInnerHTML('txt_err',getValue('err_email_null'));
		return;
		}
	else{
		document.getElementById("mess_err").style.display="none";
		if(!chkEmailAddress(getValue('username'))){
			alert(getValue('err_email_invalid'));
			setFocus('username');
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_email_invalid'));
			return;
			}
		else{
			document.getElementById("mess_err").style.display="none";
			if(getValue('password')==''){
				alert(getValue('err_pass_null'));
				setFocus('password');
				displayElement('mess_err','');
				setValInnerHTML('txt_err',getValue('err_pass_null'));
				return;
				}
			}
		}
	var strPagam = 'u='+getById('username')+'&p='+getById('password')
	doLoginSeeker('',strPagam);
	}
function chkEmailAddress(strEmail){
	var re = /^([A-Za-z0-9\_\-]+\.)*[A-Za-z0-9\_\-]+@[A-Za-z0-9\_\-]+(\.[A-Za-z0-9\_\-]+)+$/;
	if(strEmail.search(re) == -1 ){
		return false;
		}
	return true;
	}
function doLoginSeeker(response,strPagam){
	if(response != ""){
		if(response == 2){
			document.frmLogin.submit();
			}
		else if(response == -1){ 
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_method'));
			}
		else if(response == -2){ 
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_method'));
			}
		else if(response == 3){ 
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_notmatch'));
			}
		else if(response == 0){ 
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_data'));
			}
		else if(response == 1){ 
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_notreg'));
			}
		else if(response == 4){
			displayElement('mess_err','');
			setValInnerHTML('txt_err',getValue('err_ban'));
			}
		}
	else{
		var url = getValue('do_login')+"?"+strPagam;
		ajax_(url);
		}
	}
function ajax_(url){
	var check = ajax_general();
	if(check){
		check.open("GET", url, true);
		check.onreadystatechange = function() {
			if(check.readyState == 4 && check.status == 200){
				var xmlDocumentc = check.responseXML;
				var fun = xmlDocumentc.getElementsByTagName('method')[0].firstChild.data;
				var respons = xmlDocumentc.getElementsByTagName('result')[0].firstChild.data;
				eval(fun+'(respons,\'\')');
				}
			};
		check.send(null);
		}
	else{
		alert("There was a problem retrieving the XML data:\n" + check.statusText);
		}
	}
function checkFrmForgetPass(){
	if(getValue('email_get')==''){
		alert(getValue('err_email_null'));
		setFocus('email_get');
		displayElement('err_email','');
		setValInnerHTML('txt_err_email',getValue('err_email_null'));
		return;
		}
	else{
		document.getElementById("err_email").style.display="none";
		if(getValue('email_get').length < 9 || getValue('email_get').length > 255){
			alert(getValue('err_email_length'));
			setFocus('email_get');
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('err_email_length'));
			return;
			}
		else{
			if(!chkEmailAddress(getValue('email_get'))){
				alert(getValue('err_email_invalid'));
				setFocus('email_get');
				displayElement('err_email','');
				setValInnerHTML('txt_err_email',getValue('err_email_invalid'));
				return;
				}
			}
		}
	if(getValue('capt_get')==''){
		alert(getValue('err_capt_notmatch'));
		setFocus('capt_get');
		displayElement('err_capt','');
		setValInnerHTML('txt_err_capt',getValue('err_capt_notmatch'));
		return;
		}
	else{
		displayElement('err_capt','none');
		if(getValue('capt_get').length != 6){
			alert(getValue('err_capt_length'));
			setFocus('capt_get');
			displayElement('err_capt','');
			setValInnerHTML('txt_err_capt',getValue('err_capt_length'));
			return;
			}
		else{
			displayElement('err_capt','none');
			}
		}
	var url = getValue('chkUserCapt')+'?e='+getById('email_get')+'&c='+getById('capt_get');
	doChk_User_Capt('',url);
	}
function doChk_User_Capt(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){ 
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('err_email_notreg'));
			}
		else if(response == 2){ 
			displayElement('err_capt','');
			setValInnerHTML('txt_err_capt',getValue('err_capt_notmatch'));
			}
		else if(response == 3){ 
			document.frmforgetpass.submit();
			}
		}
	else{
		ajax_(url);
		}
	}
var option;
function SelectRefethCity(number){
	var id = document.getElementById('slcountry').value;
	var url = document.getElementById('CRRefetchCityURL').value+"?CountryId="+id+"&selectId="+number;
	CitySelect(url,number);
	}
function CitySelect(url,idselect){
	var form = ajax_general();
	if(form){
		form.open("GET", url, true);
		form.onreadystatechange = function() {
			if(form.readyState == 4 && form.status == 200){
				var xmlDocument = form.responseXML;
				option = xmlDocument.getElementsByTagName('option');
				value = xmlDocument.getElementsByTagName('value');
				vselect = xmlDocument.getElementsByTagName('selectedvalue');
				ListCity(idselect);
				}
			};
		form.send(null);
		}
	}
function ListCity(cityselect){
	var loopIndex;
	document.getElementById('slcity').length = 0;
	var selectControl = document.getElementById('slcity');
	for(loopIndex = 0; loopIndex < option.length; loopIndex++){
		//option[loopIndex]
		selectControl.options[loopIndex] = new Option(option[loopIndex].firstChild.data);
		//selectControl.options[loopIndex].value = loopIndex;
		selectControl.options[loopIndex].value = value[loopIndex].firstChild.data;
		if(vselect[loopIndex].firstChild.data == cityselect){
			selectControl.options[loopIndex].selected="selected";
			}
		}
	}
function refeshVerificationCode(){
	document.getElementById('code_img').innerHTML = '<img src="../include/create_image.php?'+Math.random()+'" height=22 class="code_ser" id="img_security_code"/>';
	document.getElementById('security_code').value = '';
	setFocus('security_code');
	}
function CheckUsername(){
	if(getValue('email_reg')==''){
		alert(getValue('err_email_null'));
		setFocus('email_reg');
		displayElement('err_email','');
		setValInnerHTML('txt_err_email',getValue('err_email_null'));
		return;
		}
	else{
		displayElement('err_email','none');
		if(getValue('email_reg').length < 9 || getValue('email_reg').length > 255){
			alert(getValue('err_email_length'));
			setFocus('email_reg');
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('err_email_length'));
			return;
			}
		else{
			displayElement('err_email','none');
			if(!chkEmailAddress(getValue('email_reg'))){
				alert(getValue('err_email_invalid'));
				setFocus('email_reg');
				displayElement('err_email','');
				setValInnerHTML('txt_err_email',getValue('err_email_invalid'));
				return;
				}
			}
		}
	var url = getValue('CRCheckUserNameURL')+'?e='+getById('email_reg');
	doChkEmailIsExits('',url);
	}
function doChkEmailIsExits(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){
			document.getElementById('txt_err_email').style.color = "#17a81f";
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('user_allow'));
			}
		else if(response == 2){ 
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('user_isuse'));
			}
		}
	else{
		ajax_(url);
		}
	}
function chkFrmRegisterSeek(){
	if(getValue('email_reg')==''){
		alert(getValue('err_email_null'));
		setFocus('email_reg');
		displayElement('err_email','');
		setValInnerHTML('txt_err_email',getValue('err_email_null'));
		return;
		}
	else{
		displayElement('err_email','none');
		if(getValue('email_reg').length < 9 || getValue('email_reg').length > 255){
			alert(getValue('err_email_length'));
			setFocus('email_reg');
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('err_email_length'));
			return;
			}
		else{
			displayElement('err_email','none');
			if(!chkEmailAddress(getValue('email_reg'))){
				alert(getValue('err_email_invalid'));
				setFocus('email_reg');
				displayElement('err_email','');
				setValInnerHTML('txt_err_email',getValue('err_email_invalid'));
				return;
				}
			}
		}
	if(getValue('pass_reg')==''){
		alert(getValue('err_pass_null'));
		setFocus('pass_reg');
		displayElement('err_pass','');
		setValInnerHTML('txt_err_pass',getValue('err_pass_null'));
		return;
		}
	else{
		displayElement('err_pass','none');
		if(getValue('pass_reg').length < 6 || getValue('pass_reg').length > 32){
			alert(getValue('err_pass_length'));
			setFocus('pass_reg');
			displayElement('err_pass','');
			setValInnerHTML('txt_err_pass',getValue('err_pass_length'));
			return;
			}
		else{
			displayElement('err_pass','none');
			retval = false;
			for ( i=0; i <= getValue('pass_reg').length-1; i++){
				if ( ( ( getValue('pass_reg').charCodeAt(i) >= 48)&&(getValue('pass_reg').charCodeAt(i) <= 57)) || ((getValue('pass_reg').charCodeAt(i) > 64)&&(getValue('pass_reg').charCodeAt(i) <= 90)) || ((getValue('pass_reg').charCodeAt(i) >= 97)&&(getValue('pass_reg').charCodeAt(i) <= 122)) || (getValue('pass_reg').charCodeAt(i) == 95) || (getValue('pass_reg').charCodeAt(i) == 45) ){
					retval = true;
					}
				else{
					retval = false;
					break;
					}
				}
			if (!retval){
				alert(getValue('err_pass_unicode'));
				setFocus('pass_reg');
				displayElement('err_pass','');
				setValInnerHTML('txt_err_pass',getValue('err_pass_unicode'));
				return;
				}
			else{
				displayElement('err_pass','none');
				}
			}
		}
	if(getValue('pass_reg') != getValue('confirm_reg')){
		alert(getValue('err_pass_notmatch'));
		setFocus('confirm_reg');
		displayElement('err_confirm','');
		setValInnerHTML('txt_err_confirm',getValue('err_pass_notmatch'));
		return;
		}
	else{
		displayElement('err_confirm','none');
		}
	if(getValue('fullname_reg')==''){
		alert(getValue('err_fulname_null'));
		setFocus('fullname_reg');
		displayElement('err_fullname','');
		setValInnerHTML('txt_err_fullname',getValue('err_fulname_null'));
		return;
		}
	else{
		displayElement('err_fullname','none');
		if(getValue('fullname_reg').length < 4 || getValue('pass_reg').length > 255){
			alert(getValue('err_fulname_length'));
			setFocus('fullname_reg');
			displayElement('err_fullname','');
			setValInnerHTML('txt_err_fullname',getValue('err_fulname_length'));
			return;
			}
		else{
			displayElement('err_fullname','none');
			}
		}
	if(!isValidDate(getValue('slyear'),getValue('slmonth'),getValue('slday'))){
		alert(getValue('err_birthday1'));
		setFocus('slyear');
		displayElement('err_birthday','');
		setValInnerHTML('txt_err_birthday',getValue('err_birthday1'));
		return;
		}
	else{
		displayElement('err_birthday','none');
		}
	if(getValue('slcity')==0){
		alert(getValue('err_city1'));
		setFocus('slcity');
		displayElement('err_city','');
		setValInnerHTML('txt_err_city',getValue('err_city1'));
		return;
		}
	else{
		displayElement('err_city','none');
		}
	if(getValue('security_code')==''){
		alert(getValue('err_capt_notmatch'));
		setFocus('security_code');
		displayElement('err_captcha','');
		setValInnerHTML('txt_err_captcha',getValue('err_capt_notmatch'));
		return;
		}
	else{
		displayElement('err_captcha','none');
		if(getValue('security_code').length != 6){
			alert(getValue('err_capt_length'));
			setFocus('security_code');
			displayElement('err_captcha','');
			setValInnerHTML('txt_err_captcha',getValue('err_capt_length'));
			return;
			}
		else{
			displayElement('err_captcha','none');
			}
		}
	var url = getValue('chkUserCapt')+'?e='+getById('email_reg')+'&c='+getById('security_code');
	chk_User_Capt('',url);
	}
function isValidDate(strYear,strMonth,strDay){
	var day = parseInt(strDay);	
	var month = parseInt(strMonth) - 1;
	var year = parseInt(strYear);
	if(day >0 && month >=0 && year > 0){
		source_date = new Date(year,month,day);
		if(year != source_date.getFullYear()){
			return false;
			}
		if(month != source_date.getMonth()){	 
			return false;
			}
		if(day != source_date.getDate()){
			return false;
			}			
		return true;	
		}	
	else{	 
	  	return false;
		}
	}
function chk_User_Capt(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){
			document.frmRegister.submit();
			}
		else if(response == 2){ 
			alert(getValue('err_capt_notmatch'));
			setFocus('security_code');
			displayElement('err_captcha','');
			setValInnerHTML('txt_err_captcha',getValue('err_capt_notmatch'));
			return;
			}
		else if(response == 3){ 
			alert(getValue('user_isuse'));
			setFocus('email_reg');
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('user_isuse'));
			return;
			}
		}
	else{
		ajax_(url);
		}
	}
function isNumberKey(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
         return false;
    return true;
	}
function EdtPass(idOld,idNew,intAct){
	if(intAct==1){
		displayElement(idOld,'none');
		displayElement(idNew,'');
		setFocus('pass_old');
		}
	else if(intAct==0){
		displayElement(idOld,'');
		displayElement(idNew,'none');
		}
	setValue('chkEditPass',intAct);
	}
function ChkFrmEditAccount(){
	if(getValue('chkEditPass')==1){
		if(getValue('pass_old')==''){
			alert(getValue('err_pass_null'));
			setFocus('pass_old');
			displayElement('err_pass','');
			setValInnerHTML('txt_err_pass',getValue('err_pass_null'));
			return;
			}
		else{
			displayElement('err_pass','none');
			if(getValue('pass_old').length < 6 || getValue('pass_old').length > 32){
				alert(getValue('err_pass_length'));
				setFocus('pass_old');
				displayElement('err_pass','');
				setValInnerHTML('txt_err_pass',getValue('err_pass_length'));
				return;
				}
			else{
				displayElement('err_pass','none');
				retval = false;
				for ( i=0; i <= getValue('pass_old').length-1; i++){
					if ( ( ( getValue('pass_old').charCodeAt(i) >= 48)&&(getValue('pass_old').charCodeAt(i) <= 57)) || ((getValue('pass_old').charCodeAt(i) > 64)&&(getValue('pass_old').charCodeAt(i) <= 90)) || ((getValue('pass_old').charCodeAt(i) >= 97)&&(getValue('pass_old').charCodeAt(i) <= 122)) || (getValue('pass_old').charCodeAt(i) == 95) || (getValue('pass_old').charCodeAt(i) == 45) ){
						retval = true;
						}
					else{
						retval = false;
						break;
						}
					}
				if (!retval){
					alert(getValue('err_pass_unicode'));
					setFocus('pass_old');
					displayElement('err_pass','');
					setValInnerHTML('txt_err_pass',getValue('err_pass_unicode'));
					return;
					}
				else{
					displayElement('err_pass','none');
					}
				}
			}
		if(getValue('pass_ed')==''){
			alert(getValue('err_new_pass_null'));
			setFocus('pass_ed');
			displayElement('err_new_pass','');
			setValInnerHTML('txt_err_new_pass',getValue('err_new_pass_null'));
			return;
			}
		else{
			displayElement('err_new_pass','none');
			if(getValue('pass_ed').length < 6 || getValue('pass_ed').length > 32){
				alert(getValue('err_pass_length'));
				setFocus('pass_ed');
				displayElement('err_new_pass','');
				setValInnerHTML('txt_err_new_pass',getValue('err_pass_length'));
				return;
				}
			else{
				displayElement('err_new_pass','none');
				retval = false;
				for ( i=0; i <= getValue('pass_ed').length-1; i++){
					if ( ( ( getValue('pass_ed').charCodeAt(i) >= 48)&&(getValue('pass_ed').charCodeAt(i) <= 57)) || ((getValue('pass_ed').charCodeAt(i) > 64)&&(getValue('pass_ed').charCodeAt(i) <= 90)) || ((getValue('pass_ed').charCodeAt(i) >= 97)&&(getValue('pass_ed').charCodeAt(i) <= 122)) || (getValue('pass_ed').charCodeAt(i) == 95) || (getValue('pass_ed').charCodeAt(i) == 45) ){
						retval = true;
						}
					else{
						retval = false;
						break;
						}
					}
				if (!retval){
					alert(getValue('err_pass_unicode'));
					setFocus('pass_ed');
					displayElement('err_new_pass','');
					setValInnerHTML('txt_err_new_pass',getValue('err_pass_unicode'));
					return;
					}
				else{
					displayElement('err_new_pass','none');
					}
				}
			}
		if(getValue('pass_ed') != getValue('conf_pass_ed')){
			alert(getValue('err_pass_notmatch'));
			setFocus('conf_pass_ed');
			displayElement('err_confirm','');
			setValInnerHTML('txt_err_confirm',getValue('err_pass_notmatch'));
			return;
			}
		else{
			displayElement('err_confirm','none');
			}
		}
	if(getValue('fullname_edi')==''){
		alert(getValue('err_fulname_null'));
		setFocus('fullname_edi');
		displayElement('err_fullname','');
		setValInnerHTML('txt_err_fullname',getValue('err_fulname_null'));
		return;
		}
	else{
		displayElement('err_fullname','none');
		if(getValue('fullname_edi').length < 4 || getValue('fullname_edi').length > 255){
			alert(getValue('err_fulname_length'));
			setFocus('fullname_edi');
			displayElement('err_fullname','');
			setValInnerHTML('txt_err_fullname',getValue('err_fulname_length'));
			return;
			}
		else{
			displayElement('err_fullname','none');
			}
		}
	if(!isValidDate(getValue('slyear'),getValue('slmonth'),getValue('slday'))){
		alert(getValue('err_birthday1'));
		setFocus('slyear');
		displayElement('err_birthday','');
		setValInnerHTML('txt_err_birthday',getValue('err_birthday1'));
		return;
		}
	else{
		displayElement('err_birthday','none');
		}
	if(getValue('address')==''){
		alert(getValue('err_address_null'));
		setFocus('address');
		displayElement('err_address','');
		setValInnerHTML('txt_err_address',getValue('err_address_null'));
		return;
		}
	else{
		displayElement('err_address','none');
		if(getValue('address').length < 10 || getValue('address').length > 255){
			alert(getValue('err_address_length'));
			setFocus('address');
			displayElement('err_address','');
			setValInnerHTML('txt_err_address',getValue('err_address_length'));
			return;
			}
		else{
			displayElement('err_address','none');
			}
		}
	if(getValue('slcity')==0){
		alert(getValue('err_city1'));
		setFocus('slcity');
		displayElement('err_city','');
		setValInnerHTML('txt_err_city',getValue('err_city1'));
		return;
		}
	else{
		displayElement('err_city','none');
		}
	if(getValue('Telephone') != ''){
		if(getValue('Telephone').length < 9 || getValue('Telephone').length > 15){
			alert(getValue('err_Tel_length'));
			setFocus('Telephone');
			displayElement('err_Tel','');
			setValInnerHTML('txt_err_Tel',getValue('err_Tel_length'));
			return;
			}
		else{
			displayElement('err_Tel','none');
			}
		}
	if(getValue('Handphone') != ''){
		if(getValue('Handphone').length < 9 || getValue('Handphone').length > 15){
			alert(getValue('err_Tel_length'));
			setFocus('Handphone');
			displayElement('err_Handphone','');
			setValInnerHTML('txt_err_Handphone',getValue('err_Tel_length'));
			return;
			}
		else{
			displayElement('err_Handphone','none');
			}
		}
	if(getValue('chkEditPass')==1){
		var url = getValue('chkOldpass')+'?p='+getById('pass_old');
		chkOldPassword('',url);
		}
	else{
		document.frmEditAccount.submit();
		}
	}
function chkOldPassword(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){
			document.frmEditAccount.submit();
			}
		else if(response == 2){ 
			alert(getValue('err_oldpass'));
			setFocus('pass_old');
			displayElement('err_pass','');
			setValInnerHTML('txt_err_pass',getValue('err_oldpass'));
			return;
			}
		}
	else{
		ajax_(url);
		}
	}
function chkFrmContactSeek(userId){
	if(getValue('fullname_con')==''){
		alert(getValue('err_fulname_null'));
		setFocus('fullname_con');
		displayElement('err_fullname','');
		setValInnerHTML('txt_err_fullname',getValue('err_fulname_null'));
		return;
		}
	else{
		displayElement('err_fullname','none');
		if(getValue('fullname_con').length < 4 || getValue('fullname_con').length > 255){
			alert(getValue('err_fulname_length'));
			setFocus('fullname_con');
			displayElement('err_fullname','');
			setValInnerHTML('txt_err_fullname',getValue('err_fulname_length'));
			return;
			}
		else{
			displayElement('err_fullname','none');
			}
		}
	if(getValue('email_con')==''){
		alert(getValue('err_email_null'));
		setFocus('email_con');
		displayElement('err_email','');
		setValInnerHTML('txt_err_email',getValue('err_email_null'));
		return;
		}
	else{
		displayElement('err_email','none');
		if(getValue('email_con').length < 9 || getValue('email_con').length > 255){
			alert(getValue('err_email_length'));
			setFocus('email_con');
			displayElement('err_email','');
			setValInnerHTML('txt_err_email',getValue('err_email_length'));
			return;
			}
		else{
			displayElement('err_email','none');
			if(!chkEmailAddress(getValue('email_con'))){
				alert(getValue('err_email_invalid'));
				setFocus('email_con');
				displayElement('err_email','');
				setValInnerHTML('txt_err_email',getValue('err_email_invalid'));
				return;
				}
			}
		}
	if(getValue('content_con')==''){
		alert(getValue('ContactContentNull'));
		setFocus('content_con');
		displayElement('err_content','');
		setValInnerHTML('txt_err_content',getValue('ContactContentNull'));
		return;
		}
	else{
		displayElement('err_content','none');
		if(getValue('content_con').length < 30 || getValue('content_con').length > 1000){
			alert(getValue('LengthContactContent'));
			setFocus('content_con');
			displayElement('err_content','');
			setValInnerHTML('txt_err_content',getValue('LengthContactContent'));
			return;
			}
		else{
			displayElement('err_content','none');
			}
		}
	if(userId == 0){
		if(getValue('security_code')==''){
			alert(getValue('err_capt_notmatch'));
			setFocus('security_code');
			displayElement('err_captcha','');
			setValInnerHTML('txt_err_captcha',getValue('err_capt_notmatch'));
			return;
			}
		else{
			displayElement('err_captcha','none');
			if(getValue('security_code').length != 6){
				alert(getValue('err_capt_length'));
				setFocus('security_code');
				displayElement('err_captcha','');
				setValInnerHTML('txt_err_captcha',getValue('err_capt_length'));
				return;
				}
			else{
				displayElement('err_captcha','none');
				}
			}
		var url = getValue('ckContactCapt')+'?c='+getById('security_code');
		chkContactCapt('',url);
		}
	else{
		document.frmContact.submit();
		}
	}
function chkContactCapt(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){
			document.frmContact.submit();
			}
		else if(response == 2){ 
			alert(getValue('err_capt_notmatch'));
			setFocus('security_code');
			displayElement('err_captcha','');
			setValInnerHTML('txt_err_captcha',getValue('err_capt_notmatch'));
			return;
			}
		}
	else{
		ajax_(url);
		}
	}
function doQuickSearchIndex(){
	if(getValue('txt_search')=='' && getValue('sl_indus')==0 && getValue('sl_state')==0){
		alert(getValue('enterkeyword'));
		setFocus('txt_search');
		return;
		}
	else{
		window.location = getValue('RSSearchURL')+"-"+getById('txt_search')+"-"+getValue('sl_indus')+"-"+getValue('sl_state')+"-1";
		}
	}
function regNewsJobs(intUser){
	if(getValue('email_news')==''){
		alert(getValue('err_email_null'));
		setFocus('email_news');
		return;
		}
	else{
		if(getValue('email_news').length < 9 || getValue('email_news').length > 255){
			alert(getValue('err_email_length'));
			setFocus('email_news');
			return;
			}
		else{
			if(!chkEmailAddress(getValue('email_news'))){
				alert(getValue('err_email_invalid'));
				setFocus('email_news');
				return;
				}
			}
		}
	var sl = "";
	var numof = getValue('hddItems');
	for(var i=0; i<numof; i++){
		if(document.getElementById('industry_id'+[i]).checked){
			sl = sl+"."+document.getElementById('industry_id'+[i]).value+".";
			}
		}
	if(sl==''){
		alert(getValue('getnewsnull'));
		setFocus('email_news');
		return;
		}
	var url = getValue('hd_regnews')+'?e='+getById('email_news')+'&in='+sl;
	doReciverNews('',url);
	}
function doReciverNews(response,url){
	if(response != ""){
		if(response == 0){
			alert("page send data error");
			}
		else if(response == 1){
			alert(getValue('user_isuse'));
			setFocus('email_news');
			}
		else if(response == 2){
			alert(getValue('regnews_succ'));
			document.RecieveNewJob.submit();
			}
		}
	else{
		ajax_(url);
		}
	}
function changeSalary(objSource,intFrom,intto){
	if(objSource.value==1 || objSource.value==4 || objSource.value == 0){
		document.getElementById('tab_salary').style.display='none';
		}
	else{
		document.getElementById('tab_salary').style.display='';
		var url = document.getElementById('DRURLSalaryType').value+"?Id="+objSource.value+"&from="+intFrom+"&to="+intto;
		AjaxRefethSalary(url,intFrom,intto);
		}
	}
function AjaxRefethSalary(url,intFrom,intto){
	var Salary = ajax_general();
	if(Salary){
		Salary.open("GET", url, true);
		Salary.onreadystatechange = function() {
			if(Salary.readyState == 4 && Salary.status == 200){
				var xmlDocument = Salary.responseXML;
				option = xmlDocument.getElementsByTagName('from');
				value = xmlDocument.getElementsByTagName('valuefrom');
				valueselect = xmlDocument.getElementsByTagName('valueselectedfrom');
				ListSalaryFrom(intFrom);
				option = xmlDocument.getElementsByTagName('to');
				value = xmlDocument.getElementsByTagName('valueto');
				valueselect = xmlDocument.getElementsByTagName('valueselectedto');
				ListSalaryTo(intto);
				}
			};
		Salary.send(null);
		}
	}
function ListSalaryFrom(intFrom){
	var loopIndex;
	document.getElementById('tab_salary_from').length = 0;
	var selectControl = document.getElementById('tab_salary_from');
	for(loopIndex = 0; loopIndex < option.length; loopIndex++){
		//option[loopIndex]
		selectControl.options[loopIndex] = new Option(option[loopIndex].firstChild.data);
		//selectControl.options[loopIndex].value = loopIndex;
		selectControl.options[loopIndex].value = value[loopIndex].firstChild.data;
		if(intFrom==valueselect[loopIndex].firstChild.data){
			selectControl.options[loopIndex].selected="selected";
			}
		}
	}
function ListSalaryTo(intto){
	var loopIndex;
	document.getElementById('tab_salary_to').length = 0;
	var selectControl = document.getElementById('tab_salary_to');
	for(loopIndex = 0; loopIndex < option.length; loopIndex++){
		//option[loopIndex]
		selectControl.options[loopIndex] = new Option(option[loopIndex].firstChild.data);
		//selectControl.options[loopIndex].value = loopIndex;
		selectControl.options[loopIndex].value = value[loopIndex].firstChild.data;
		if(intto==valueselect[loopIndex].firstChild.data){
			selectControl.options[loopIndex].selected="selected";
			}
		}
	}
function openWindow(url,width,height){
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));
	var windowFeatures = "width=" + width + ",height=" + height + 
		",status,scrollbars=1,resizable=no,menubar=no,left=" + left + ",top=" + top + 
		",screenX=" + left + ",screenY=" + top;
	window.open(url, "Info", windowFeatures);
	}
function AjaxInnerHtml(url,strId){
	var loads = ajax_general();
	if(loads){
		loads.onreadystatechange = function() {
			if(loads.readyState == 4 && loads.status == 200){
				var textDocument = loads.responseText;
				document.getElementById(strId).innerHTML = textDocument;
				}
			};
		var nocache = Math.random();
		loads.open("GET",url+"&nocache="+nocache,true);
		loads.send(null);
		}
	else{
		alert("There was a problem retrieving the XML data:\n" + loads.statusText);
		}
	$('html,body').animate({scrollTop: $("#"+strId).offset().top},'slow');
	}
function AjaxLoadInnerHtml(url,strId){
	var loads = ajax_general();
	if(loads){
		loads.onreadystatechange = function() {
			if(loads.readyState == 4 && loads.status == 200){
				var textDocument = loads.responseText;
				document.getElementById(strId).innerHTML = textDocument;
				}
			};
		var nocache = Math.random();
		loads.open("GET",url+"&nocache="+nocache,true);
		loads.send(null);
		}
	else{
		alert("There was a problem retrieving the XML data:\n" + loads.statusText);
		}
	}
function chkFrmChangePassEmp(){
	if(getValue('oldpass')==''){
		alert(getValue('err_pass_null'));
		setFocus('oldpass');
		displayElement('disperr_old','');
		setValInnerHTML('txterr_old',getValue('err_pass_null'));
		return;
		}
	else{
		displayElement('disperr_old','none');
		if(getValue('oldpass').length < 6 || getValue('oldpass').length > 32){
			alert(getValue('err_pass_length'));
			setFocus('oldpass');
			displayElement('disperr_old','');
			setValInnerHTML('txterr_old',getValue('err_pass_length'));
			return;
			}
		else{
			displayElement('disperr_old','none');
			}
		}
	if(getValue('newpass')==''){
		alert(getValue('err_pass_null_new'));
		setFocus('newpass');
		displayElement('disperr_new','');
		setValInnerHTML('txterr_new',getValue('err_pass_null'));
		return;
		}
	else{
		displayElement('disperr_new','none');
		if(getValue('newpass').length < 6 || getValue('newpass').length > 32){
			alert(getValue('err_pass_length'));
			setFocus('newpass');
			displayElement('err_pass','');
			setValInnerHTML('txterr_new',getValue('err_pass_length'));
			return;
			}
		else{
			displayElement('disperr_new','none');
			retval = false;
			for ( i=0; i <= getValue('newpass').length-1; i++){
				if ( ( ( getValue('newpass').charCodeAt(i) >= 48)&&(getValue('newpass').charCodeAt(i) <= 57)) || ((getValue('newpass').charCodeAt(i) > 64)&&(getValue('newpass').charCodeAt(i) <= 90)) || ((getValue('newpass').charCodeAt(i) >= 97)&&(getValue('newpass').charCodeAt(i) <= 122)) || (getValue('newpass').charCodeAt(i) == 95) || (getValue('newpass').charCodeAt(i) == 45) ){
					retval = true;
					}
				else{
					retval = false;
					break;
					}
				}
			if (!retval){
				alert(getValue('err_pass_unicode'));
				setFocus('newpass');
				displayElement('disperr_new','');
				setValInnerHTML('txterr_new',getValue('err_pass_unicode'));
				return;
				}
			else{
				displayElement('disperr_new','none');
				}
			}
		}
	if(getValue('newpass') != getValue('confirmpass')){
		alert(getValue('err_pass_notmatch'));
		setFocus('confirmpass');
		displayElement('disperr_conf','');
		setValInnerHTML('txterr_conf',getValue('err_pass_notmatch'));
		return;
		}
	else{
		displayElement('disperr_conf','none');
		}
	var str='op='+getById('oldpass');
	chkEmpPassOld('',str);
	}
function chkEmpPassOld(status,strpagam){
	if(status != ""){
		if(status==0 || status==-1){
			alert(getValue('CLActiveError'));
			}
		else if(status==1){
			alert(getValue('curPassInvalid'));
			setFocus('oldpass');
			displayElement('disperr_old','');
			setValInnerHTML('txterr_old',getValue('curPassInvalid'));
			}
		else if(status==2){
			document.frmChangePassEmp.submit();
			}
		}
	else{
		var url = getValue('chkpassurl')+"?"+strpagam;
		ajax_(url);
		}
	}